<?php

class Empeval_Methods_Request_GetRejections {
	
	/**
	 *
	 * @var App_Methods_Data_App
	 */
	public $app;
	
	public function __construct($params) {
		$this->app = new App_Methods_Data_App($params->app);
	}
	
	public function process() {
		if (!(Empeval_Auth::getInstance()->getUser()->isHr() || Empeval_Auth::getInstance()->getUser()->isAdmin()))
			throw new Empeval_Exception_App(Empeval_Exception_Codes::INFO_ACCESS_DENIED);
		
		$rejections = EmpevalViewRejectionsQuery::create()
			->filterByActive(1)
			->orderByStatus(Criteria::ASC)
			->orderByCreated(Criteria::ASC)
			->find();
		
		return new Empeval_Methods_Response_GetRejections(true, $rejections);
	}
	
}